<?php

use yii\db\Migration;

/**
 * Handles the creation of table `faq`.
 */
class m171120_035430_create_faq_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('faq', [
            'id' => $this->primaryKey(),
            'title' => $this->string(64)->notNull()->comment('标题'),
            'auth' => $this->string(32)->comment('作者'),
            'content' => $this->text()->notNull()->comment('正文'),
            'seo_title' => $this->string(64)->comment('页面标题'),
            'seo_keywords' => $this->string(128)->comment('页面关键字'),
            'seo_description' => $this->string(512)->comment('页面描述'),

            //生成的model继承BaseModel，即可实现以下四个属性的自动更新
            'created_at' => $this->dateTime()->comment('创建时间'),
            'updated_at' => $this->dateTime()->comment('更新时间'),
            'created_by' => $this->integer()->comment('创建者'),
            'updated_by' => $this->integer()->comment('更新者'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('faq');
    }
}
